package com.example.knowing_project.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 电子书快照表
 * @TableName ebook_snapshot
 */
@TableName(value ="ebook_snapshot")
@Data
public class EbookSnapshot implements Serializable {
    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 电子书id
     */
    private Long ebook_id;

    /**
     * 快照日期
     */
    private Date date;

    /**
     * 阅读数
     */
    private Integer view_count;

    /**
     * 点赞数
     */
    private Integer vote_count;

    /**
     * 阅读增长
     */
    private Integer view_increase;

    /**
     * 点赞增长
     */
    private Integer vote_increase;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        EbookSnapshot other = (EbookSnapshot) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getEbook_id() == null ? other.getEbook_id() == null : this.getEbook_id().equals(other.getEbook_id()))
            && (this.getDate() == null ? other.getDate() == null : this.getDate().equals(other.getDate()))
            && (this.getView_count() == null ? other.getView_count() == null : this.getView_count().equals(other.getView_count()))
            && (this.getVote_count() == null ? other.getVote_count() == null : this.getVote_count().equals(other.getVote_count()))
            && (this.getView_increase() == null ? other.getView_increase() == null : this.getView_increase().equals(other.getView_increase()))
            && (this.getVote_increase() == null ? other.getVote_increase() == null : this.getVote_increase().equals(other.getVote_increase()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getEbook_id() == null) ? 0 : getEbook_id().hashCode());
        result = prime * result + ((getDate() == null) ? 0 : getDate().hashCode());
        result = prime * result + ((getView_count() == null) ? 0 : getView_count().hashCode());
        result = prime * result + ((getVote_count() == null) ? 0 : getVote_count().hashCode());
        result = prime * result + ((getView_increase() == null) ? 0 : getView_increase().hashCode());
        result = prime * result + ((getVote_increase() == null) ? 0 : getVote_increase().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ebook_id=").append(ebook_id);
        sb.append(", date=").append(date);
        sb.append(", view_count=").append(view_count);
        sb.append(", vote_count=").append(vote_count);
        sb.append(", view_increase=").append(view_increase);
        sb.append(", vote_increase=").append(vote_increase);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}